# compiler setting
CC=clang
RM=rm

# include path
IFLAGS=-I. -IFatFs
IFLAGS+=-Icmd

# compiler flag
CFLAGS=-g -Wall
CFLAGS+=$(IFLAGS)

# linker flag
LDFLAGS=-g -lc

# source 
C_SRC=atadrive.c diskio.c ff.c main.c sdcard.c usbdisk.c
OPTION_C_SRC=cc936.c
CMD_SRC=cmd.c do_env.c do_sys.c var.c do_dos_cmd.c

C_SRC+=$(OPTION_C_SRC) $(CMD_SRC)

# objects
OBJS=$(C_SRC:.c=.o) 

# vpath
VPATH=FatFs:FatFs/option:cmd

# targets
.PHONY:clean
all: demo
demo:$(OBJS)
	$(CC) $(LDFLAGS) -o $@ $^

clean:
	$(RM) -f $(OBJS) demo

%.o.%.c:
	$(CC) $(CFLAGS) -c $<

